package pruebas;


import java.awt.event.ActionEvent;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;

import javax.swing.JButton;

import Sintactico.AnalizadorSintactico;



public class Prueba extends JFrame{

	private static final long serialVersionUID = 1L;
	JTextArea programa;
	JPanel contentPane;
	JTextArea errores;
	AnalizadorSintactico sintactico;
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
			Prueba frame = new Prueba();
			frame.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public Prueba(){
		this.contentPane= new JPanel();
		this.errores=new JTextArea();
		errores.setBounds(300, 0, 484, 500);
		this.programa= new JTextArea();
		programa.setBounds(0, 0, 200, 500);
		contentPane.setLayout(null);
		this.contentPane.add(this.programa);
		this.contentPane.add(this.errores);
		this.programa.setText("Codigo de Programa");
		this.errores.setText("ERRORES:");
		this.sintactico=new AnalizadorSintactico();
		
		getContentPane().add(this.contentPane);
		
		JButton btnNewButton = new JButton("Comprobar");
		btnNewButton.addActionListener(new java.awt.event.ActionListener(){
			public void actionPerformed(ActionEvent e) {
				try {
					sintactico.calcula(programa.getText());
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				errores.setText(sintactico.getErrores()+""+"BIEN");
			}
		});
		btnNewButton.setBounds(201, 179, 85, 23);
		contentPane.add(btnNewButton);
		this.setVisible(true);
		this.setResizable(true);
		this.setSize(800, 500);
		this.setEnabled(true);
		
	}
}
